package com.leyou.item.mapper;

import com.leyou.item.interfaces.pojo.Category;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;

/**
 * 通用Mapper的接口
 * @version 1.0.0
 * @Author yong.Mr
 * @data 2020-01-12
 */
public interface CategoryMapper extends Mapper<Category> {

    // 根据品牌Id查询商品分类----->#{bid}参数上记得使用@Param("bid")标记, 否则参数会找不到
    @Select("SELECT * FROM tb_category WHERE ID IN (SELECT category_id FROM tb_category_brand WHERE brand_id = #{bid})")
    List<Category> queryByBrandId(@Param("bid") Long bid);
}
